<?php
		if(true){
		//page_1
			if ($_GET['page']) {
				$page = $_GET['page'];
				if(is_numeric($page)){
				}else{
					$page = 1;
				}
			} else {
				$page = 1;
			}
			$per_page = 10;//每页显示20条
			if($page<=1){$page=1;}//最大值还没有设置,在后面的db结果设置
			$start_from = ($page-1)*$per_page;
		}


?>
<?php
/*
 * Created on 2011-11-9
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 			 $current_url = $_SERVER['PHP_SELF'].'?main=chushou_list';
            $userid = $_SESSION['user_id'];
            $userid = $_SESSION['user_id'];
         	require_once("./includes/configure.php");
			require_once("./includes/database.php");
			 require_once("./includes/func.php");

			$db = Database::Connect();

		      if(true){
			//page_2
				$count_sql = "select count(*) from zufang where type=1 and faburen=$userid";

				$count_result = $db->GetResultSet($count_sql);
				while ($count_row = mysql_fetch_array($count_result)) {
					$total_item = $count_row[0];
				}
				$max_page = ceil($total_item/$per_page);
			}
			$sql = "select * from zufang where type=1 and faburen=$userid ";//默认0为出租
			$sql.=" order by time desc limit $start_from,$per_page";
		    $zufangrows = $db->GetResultSet($sql) or die ("出错啦!");


?>
<div class="right_container">
	        <div id="MyAnjuke">
	<div class="tab">
        <h1>
        <dl><dt class="tL"></dt><dt class="t0">我发布的出售信息</dt><!-- <dt class="refresh"><a href="http://my.anjuke.com/community/concerned/W0QQpZ0">刷新</a></dt> --><dt class="tR"></dt></dl>
        </h1>
	</div>
	<div class="show">


        	<div class="p2974">
<?php
			while($row = mysql_fetch_array($zufangrows)){
				$xiaoquid = $row['xiaoqu'];
				$huxing = $row['huxing'];
	            $huxing = explode('|',$huxing);
	            $huxing_shi = $huxing[0].'室';
	            $huxing_ting = $huxing[1].'厅';
	            $huxing_wei = $huxing[2].'卫';
	            $huxing = $huxing_shi.$huxing_ting.$huxing_wei;

	            $tupian = $row['tupian'];
	            $tupian = explode(";",$tupian);



?>
                                <div onmouseout="this.className='box'" onmouseover="this.className='box boxv'" _onclick="window.open('');" class="box" >
                	<div style="display:none;" class="boxdialogs" id="del_box_0_apf_id_1">
                    	<div class="boxdialog">
                        	<p class="x2"><code onclick="document.getElementById('del_box_0_apf_id_<?php echo $row['id']?>').style.display='none';"  style="cursor:pointer" title="关闭"></code></p>
                        	<p>确定要删除选中的售房吗？</p>
                            <p>
                            <input type="hidden" value="56996">
                           <input type="button" onclick="window.location='delete_fangwu.php?type=chushou&id=<?php echo $row['id']?>';
                           document.getElementById('del_box_0_apf_id_<?php echo $row['id']?>').style.display='none'" value=" 确定 "><input type="button" class="hid"><input type="button" onclick="document.getElementById('del_box_0_apf_id_<?php echo $row['id']?>').style.display='none'" value=" 取消 "></p>
                        </div>
                    </div>
                	<div onclick="document.getElementById('del_box_0_apf_id_<?php echo $row['id']?>').style.display='block'" style="cursor:pointer;" title="删除" class="x" ></div>
                    <a target="_blank" href="fangwu.php?id=<?php echo $row['id']?>"><img class="propimg" src="<?php echo './'.$tupian[0] ?>"></a>
                    <div class="propinfo">
                    	<p class="p1"><a target="_blank" href="fangwu.php?id=<?php echo $row['id']?>" id="stopClick_apf_id_1"><?php echo $row['biaoti'] ?></a></p>
                        <p><?php echo $row['dizhi']?></p>
                        <p title="">户型:<em><?php echo $huxing ?></em>     </div>

                    <div class="saleprice"><em><?php echo $row['jiage']?></em>&nbsp;万元</div>
                    <div class="boxdialogs" id="sub_box_0_apf_id_1">
                    	<div class="boxdialog">
                        	<p class="x2"><code onclick="document.getElementById('sub_box_0_apf_id_1').style.display='none'" title="关闭"></code></p>
                        	<p>订阅成功！该小区有新房源时，我们会发邮件通知您。</p>
                            <p><input type="button" onclick="document.getElementById('sub_box_0_apf_id_1').style.display='none'" value="确定"></p>
                        </div>
                    </div>

                </div>

         <?php } ?>

                		        <div style="display:none;" class="clear_all"><a class="report" id="rpt_apf_id_1" href="javascript:">清除全部</a></div>
				<div style="display:none" class="dialog" id="apf_id_11">
<div class="view_prop_popup_rpt" id="popup_apf_id_11">
    <div class="content">
        <form action="" method="POST" id="rptForm">
            <input type="hidden" value="1" name="submittype" id="submittype">
            <div><span class="close" style="cursor:pointer"><img border="0" src="http://pages.anjukestatic.com/img/reg/icon.close_8x9.gif"></span></div>
            <div class="msg">
                <div>你确定要删除全部收藏的小区吗？</div>
                <div class="button"><div onclick="$('rptForm').submit();;">确定</div><div class="close">取消</div></div>
            </div>
        </form>
    </div>
</div>
</div>
                  	<?php if(true){
	//page_3
?>
<div class="multipage">

	<?php
		if($page!=1){
			echo '<a class="prv" href="'.deleteRepeatVar($current_url,'page').'&page='.($page-1).'"><span>上一页</span></a>';
		}
		if($max_page>10){
			$ind = $page-5;
		}
		if($ind<=0){
			$ind=1;
		}
		$page_show_total = 10;//最多显示10页
		for(;$ind<=$max_page;$ind++){
			if($ind==$page){
				echo '<strong><span>'.$ind.'</span></strong>';
			}else{
				echo '<a href="'.deleteRepeatVar($current_url,'page').'&page='.$ind.'"><span>'.$ind.'</span></a>';
			}
			$page_show_total--;
			if($page_show_total==0){
				break;
			}
		}
		if($page!=$max_page && $max_page!=0){
			echo '<a class="next" href="'.deleteRepeatVar($current_url,'page').'&page='.($page+1).'"><span>下一页</span></a>';
		}
		if($total_item ==0){
			echo "你还没发布出售信息，刚快行动吧！<a href='geren.php?main=chushou_post'>我要发布出售信息</a>";
		}
	?>
			</div>

<?php }
$db->Close();
?>

			</div>
</div>

	    </div>
